<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>

    </style>
</head>
<body style="background: #ffffff;box-shadow:inset 0px 15px 10px -15px #ccc;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">清除测试数据</div>
      </div>
      <!--  -->
      <el-table :data="tabledata" @cell-click="">
        <el-table-column label="清除内容" width="" fixed>
          <template slot-scope="scope">
            {{scope.row.title}}
          </template>
        </el-table-column>
        <el-table-column label="清除前数据" width="">
          <template slot-scope="scope">
            {{scope.row.num1}}
          </template>
        </el-table-column>
        <el-table-column label="清除后数据" width="">
          <template slot-scope="scope">
            {{scope.row.num2}}
          </template>
        </el-table-column>
      </el-table>
      <!--  -->
      <div class="x-pro-gobtn" @click="goremove" style="position: fixed;bottom: 10px;left: 10px;right: 10px;z-index: 1;">清除测试数据</div>
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {
    


    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
            tabledata:[]
        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;

      },
      methods: {
            goremove:function(){
                let that = this;
                api.confirm({
                    title: '确定清除测试数据吗',
                    msg: '',
                    buttons: ['确定', '取消']
                }, function(ret, err) {
                    var index = ret.buttonIndex;
                    if(index==1){
                        that.okremove()
                    }else{
                        
                    }
                });
            },
            okremove:function(){
                let that=this;
                api.ajax({
                    url:baseurl+'api/material/test',
                    methods:'get',
                    data:{
                    values:{
                        sec: $api.getStorage('apptoken')
                    }
                    }
                },function(ret,err){
                    if(ret){
                    api.hideProgress();
                    console.log(JSON.stringify(ret));
                    if(ret.status == 1){
                        api.toast({
                            msg: '清除成功',
                            duration: 3000,
                            location: 'bottom'
                        });
                        that.tabledata = ret.data.list;

                    }else{
                        api.toast({
                            msg: ret.msg,
                            duration: 3000,
                            location: 'bottom'
                        });
                    }
                    }else{
                    api.hideProgress();
                    console.log(JSON.stringify(err));
                    api.toast({
                        msg: err.msg,
                        duration: 3000,
                        location: 'bottom'
                    });
                    }
                })
            },
      }
    })
	}

	</script>
</body>
</html>
